{include="header"}

<script type="text/javascript">
   function eliminar_divisa(cod)
   {
      if( confirm("¿Realmente desea eliminar la divisa "+cod+"?") )
         window.location.href = '{$fsc->url()}&delete='+cod;
   }
</script>

<div class="table-responsive">
   <table class="table table-hover">
      <thead>
         <tr>
            <th class="text-left">Código</th>
            <th class="text-left">Símbolo</th>
            <th class="text-left">Descripción</th>
            <th class="text-left">Código ISO</th>
            <th class="text-left">Tasa de conversión</th>
            <th class="text-right" width="120">Acciones</th>
         </tr>
      </thead>
      {loop="$fsc->divisa->all()"}
      <form action="{$fsc->url()}" method="post" class="form">
         <tr>
            <td>
               <input type="hidden" name="coddivisa" value="{$value->coddivisa}"/>
               <div class="form-control">{$value->coddivisa}</div>
            </td>
            <td>
               <input class="form-control" type="text" name="simbolo" value="{$value->simbolo}" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="descripcion" value="{$value->descripcion}" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="codiso" value="{$value->codiso}" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="tasaconv" value="{$value->tasaconv}" autocomplete="off"/>
            </td>
            <td class="text-right">
               <div class="btn-group">
                  <a href="#" class="btn btn-sm btn-danger" title="Eliminar" onclick="eliminar_divisa('{$value->coddivisa}')">
                     <span class="glyphicon glyphicon-trash"></span>
                  </a>
                  <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();" title="Guardar">
                     <span class="glyphicon glyphicon-floppy-disk"></span>
                  </button>
               </div>
            </td>
         </tr>
      </form>
      {/loop}
      <form action="{$fsc->url()}" method="post" class="form">
         <tr class="bg-info">
            <td>
               <input class="form-control" type="text" name="coddivisa" autocomplete="off" placeholder="Nueva..."/>
            </td>
            <td>
               <input class="form-control" type="text" name="simbolo" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="descripcion" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="codiso" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="tasaconv" value="1" autocomplete="off"/>
            </td>
            <td class="text-right">
               <div class="btn-group">
                  <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();" title="Guardar">
                     <span class="glyphicon glyphicon-floppy-disk"></span>
                  </button>
               </div>
            </td>
         </tr>
      </form>
   </table>
</div>

{include="footer"}